package o;

import android.app.AlertDialog;
import android.content.Context;
import com.huawei.appgallery.foundation.ui.framework.widget.dialog.dialogactivity.DialogActivity;
import o.brc.e;
import o.bww.h;
import o.bxg.d;
import o.ckh.a;

public class bxu {
    public fkd<bxc> ˏ(Context context, long j, int i, String str, boolean z) {
        final fkh o_fkh = new fkh();
        if (doo.ˊ(bqy.ˋ().ˏ())) {
            final Context context2 = context;
            final long j2 = j;
            final int i2 = i;
            final String str2 = str;
            ((cbh) fho.ˏ().ˋ("User").ॱ(cbh.class)).ˎ(context, 1, z).ˏ(new fjq<Boolean>(this) {
                final /* synthetic */ bxu ʽ;

                public void onComplete(fjo<Boolean> o_fjo_java_lang_Boolean) {
                    if (!o_fjo_java_lang_Boolean.ˊ()) {
                        return;
                    }
                    if (((Boolean) o_fjo_java_lang_Boolean.ॱ()).booleanValue()) {
                        this.ʽ.ˏ(context2, j2, i2, o_fkh, str2);
                        return;
                    }
                    o_fkh.ˋ(new bxc(10, false));
                    o_fkh.ˏ();
                }
            });
            return o_fkh.ˊ();
        }
        if (z) {
            ezn.ˊ().ˊ(context.getString(h.ʽॱ));
        } else {
            evk.ˏ(context, h.ʽॱ, 0).ˋ();
        }
        o_fkh.ˋ(new bxc(8, false));
        o_fkh.ˏ();
        return o_fkh.ˊ();
    }

    private void ˏ(final Context context, long j, int i, final fkh<bxc> o_fkh_o_bxc, String str) {
        o_fkh_o_bxc.ˋ(new bxc(9, true));
        ((brc) fho.ˏ().ˋ("Base").ॱ(brc.class)).ˋ(new d(j, i).ˊ("").ॱ(bsv.ॱ(str)).ˎ(), new e<bxg, bxh>(this) {
            final /* synthetic */ bxu ˊ;

            public /* synthetic */ void ˋ(Object obj, Object obj2) {
                ˊ((bxg) obj, (bxh) obj2);
            }

            public /* synthetic */ void ˏ(Object obj, Object obj2) {
                ˎ((bxg) obj, (bxh) obj2);
            }

            public void ˎ(bxg o_bxg, bxh o_bxh) {
            }

            public void ˊ(bxg o_bxg, bxh o_bxh) {
                boolean z = o_bxh.getResponseCode() == 0 && o_bxh.getRtnCode_() == 0;
                if (z) {
                    o_fkh_o_bxc.ˋ(new bxc(0, true));
                } else {
                    evk.ˏ(context.getString(bse.ˏ.ॱ(o_bxh.getRtnCode_()).ˏ()));
                    o_fkh_o_bxc.ˋ(new bxc(-1, false));
                }
                o_fkh_o_bxc.ˏ();
            }
        });
    }

    public fkd<bxc> ˊ(Context context, long j, int i, String str, boolean z) {
        final fkh o_fkh = new fkh();
        if (doo.ˊ(bqy.ˋ().ˏ())) {
            final Context context2 = context;
            final long j2 = j;
            final int i2 = i;
            final String str2 = str;
            ((cbh) fho.ˏ().ˋ("User").ॱ(cbh.class)).ˎ(context, 1, z).ˏ(new fjq<Boolean>(this) {
                final /* synthetic */ bxu ॱॱ;

                public void onComplete(fjo<Boolean> o_fjo_java_lang_Boolean) {
                    if (!o_fjo_java_lang_Boolean.ˊ()) {
                        return;
                    }
                    if (((Boolean) o_fjo_java_lang_Boolean.ॱ()).booleanValue()) {
                        this.ॱॱ.ॱ(context2, j2, i2, o_fkh, str2);
                        return;
                    }
                    o_fkh.ˋ(new bxc(10, false));
                    o_fkh.ˏ();
                }
            });
            return o_fkh.ˊ();
        }
        if (z) {
            ezn.ˊ().ˊ(context.getString(h.ʽॱ));
        } else {
            evk.ˏ(context, h.ʽॱ, 0).ˋ();
        }
        o_fkh.ˋ(new bxc(8, false));
        o_fkh.ˏ();
        return o_fkh.ˊ();
    }

    private void ॱ(Context context, long j, int i, fkh<bxc> o_fkh_o_bxc, String str) {
        byb o_byb = new byb(context, h.ॱॱ);
        o_byb.ˏ(h.ॱ);
        final Context context2 = context;
        final long j2 = j;
        final int i2 = i;
        final fkh<bxc> o_fkh_o_bxc2 = o_fkh_o_bxc;
        final String str2 = str;
        o_byb.ˏ(new a(this) {
            final /* synthetic */ bxu ʻ;

            public void ˏ(AlertDialog alertDialog, DialogActivity.a aVar, int i) {
                if (-1 == i) {
                    this.ʻ.ˏ(context2, j2, i2, o_fkh_o_bxc2, str2);
                }
            }
        });
        o_byb.ॱ();
    }
}
